import $axios, { Result } from '@/plugins/axios'
import { AxiosResponse } from 'axios'
import { PageParam } from '@/type'

/**
 * 分页查询事项
 * @param pageParam
 */
export async function getMatterByPage(
  pageParam: PageParam,
): Promise<AxiosResponse<Result>> {
  return await $axios.post('/supervision-api/matter/getMatterByPage', pageParam)
}

/**
 * 查询事项详情
 * @param matterId
 */
export async function getMatterDetail(
  matterId: number,
): Promise<AxiosResponse<Result>> {
  return await $axios.get(`/supervision-api/matter/getMatterDetail/${matterId}`)
}

/**
 * 查询事项下的期限
 * @param matterId
 */
export async function getDeadlinesByMatterId(
  matterId: number,
): Promise<AxiosResponse<Result>> {
  return await $axios.get(
    `/supervision-api/matter/getDeadlinesByMatterId/${matterId}`,
  )
}

/**
 * 根据事项ID查询带有办理状态的期限反馈数据
 * @param matterId
 */
export async function getMatterFeedbackDeadlinesByMatterId(
  matterId: number,
): Promise<AxiosResponse<Result>> {
  return await $axios.get(
    `/supervision-api/matterFeedback/getDeadlinesByMatterId`,
    {
      params: {
        matterId,
      },
    },
  )
}
